home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / buildConvertMM.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.7 KB  |  96 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  11 January 2002
  22. //
  23. //  Procedure Name:
  24. //      buildConvertMM
  25. //
  26. //  Description:
  27. //      This procedure creates the popup/marking menu
  28. //        for surface component conversion (ctrl RMB)
  29. //      that gets attached to the main view panes.  
  30. //        This menu builds dynamically, and changes its
  31. //        contents based on what item the mouse is clicked
  32. //        over.
  33. //
  34. //  Input Arguments:
  35. //      The parent item to parent the popup menu to.
  36. //
  37. //  Return Value:
  38. //      None.
  39.  
  40.  
  41. global proc buildConvertMM(string $parent)
  42. {
  43.     //    first determine the lead object (last selected object)
  44.     string $leadObject[] = `ls -selection -tail 1`;
  45.     string $shape[];
  46.     if (0 < size($leadObject)){
  47.  
  48.         //    user must have something selected
  49.         //    generally it's components
  50.         $shape = `listRelatives -parent -shapes $leadObject[0]`;
  51.  
  52.         //    but it may be objects
  53.         if (size($shape) < 1) {
  54.             $shape = `listRelatives -children -shapes $leadObject[0]`;
  55.         }
  56.     } else {
  57.         $shape[0] = "";
  58.     }
  59.  
  60.     //    build the appropriate conversion marking menu
  61.     string $nodeType;
  62.     if( $shape[0] != "") {
  63.         $nodeType = `nodeType $shape[0]`;
  64.         if ($nodeType == "mesh" || 
  65.             $nodeType == "nurbsSurface" || 
  66.             $nodeType == "subdiv")
  67.         {
  68.             $nodeType = $nodeType;
  69.         } else {
  70.                 $nodeType = "noConversion";
  71.         }    
  72.  
  73.     //    if there is no appropriate conversion marking menu
  74.     //    build the windows marking menu
  75.     } else {
  76.             $nodeType = "noConversion";
  77.         }
  78.     
  79.     switch( $nodeType ) {
  80.         case "mesh":
  81.             polyConvertMM( $parent ); 
  82.             break;
  83.         case "nurbsSurface":
  84.             nurbsConvertMM( $parent ); 
  85.             break;
  86.         case "subdiv":
  87.             subdConvertMM( $parent ); 
  88.             break;
  89.         case "noConversion":
  90.             buildObjectMenuItemsNow( $parent );
  91.             break;
  92.         default:
  93.             break;
  94.     }
  95.     
  96. }